class Solution
{
public:
    int findCenter(vector<vector<int>> &edges)
    {
        vector<int> inDegre(edges.size() + 2, 0);
        for (auto &edge : edges)
        {
            for (int node : edge)
            {
                ++inDegre[node];
                if (inDegre[node] > 1)
                {
                    return node;
                }
            }
        }
        return 0;
    }
};